<?php

namespace HuoShu;

class Member{
    private $mid;
    public function __construct() {
        
    }
    
    public function setMid($memberid){
        $this->mid=$memberid;
    }
    public function NamePwdMatch($name,$pwd){
        $en_pwd=member_password($pwd);        
        $data=M('members')->where(array("username"=>$name,"password"=>$en_pwd))->find();
        return $data;
    }
    
    public function PwdMatch($pwd){
        $en_pwd=member_password($pwd);        
        $data=M('members')->where(array("id"=>$this->mid,"password"=>$en_pwd))->find();
        return $data;
    }
    
    public function setPwd($pwd){
        $en_pwd=member_password($pwd);        
        $data=M('members')->where(array("id"=>$this->mid))->setField("password",$en_pwd);
        return $data;
    }
    
    public function mem_id_exists($mem_id){
        return M('members')->where(array("id"=>$mem_id))->find();
    }
}

